package snakesladers.view;

import java.awt.Point;

import minidraw.boardgame.PositioningStrategy;
import snakesladders.domain.Square;

public class SnakeLaddersPositionStrategy implements PositioningStrategy<Square> {

	@Override
	public Point calculateFigureCoordinatesForProps(String keyOfProp) {
		if (keyOfProp == Constant.diePropName) {
			return new Point(690,40);
		}
		return null;
	}

	@Override
	public Point calculateFigureCoordinatesIndexedForLocation(Square location, int index) {
		int sqindex = location.index();
		//note the tricky board layout - what is square 18 is visually
		//square 19!
		if (sqindex > 17) { sqindex++; }
		//calculate the row and colum
		int row = (sqindex-1) / 7;
		int colum = (sqindex-1) % 7;
		
		return new Point(20+colum*92 + index*20, 400-row*92);
	}
}